// src/mock/mockData/menuData.ts
import Mock from 'mockjs';
import { Document, Setting } from '@element-plus/icons-vue'; // 假设你使用的是 Element Plus 的图标


// 模拟菜单数据，改为后面动态
/*
const menuData = Mock.mock({
  data: [
    { index: 'Home', label: '首页', icon: Document },
    {
      index: 'SysSettings',
      label: '系统设置',
      icon: Setting,
      children: [
        { index: 'UserInfo', label: '个人资料' },
        { index: 'AccountSetting', label: '账户设置' },
      ],
    },
  ],
});
*/

 
// 动态生成菜单数据
export default (data: any) => {
  // 解析传入的 data 参数
  const { username, password } = data;
 

  // 根据用户名和密码生成不同的响应
  if (username === 'admin') {
    return Mock.mock({
      status_code: 200,
      status: 'success',
      message: 'Operation successful.',
      data:  [
        { index: 'Home', label: '首页', icon: Document },
        {
          index: 'SysSettings',
          label: '系统设置',
          icon: Setting,
          children: [
            { index: 'UserInfo', label: '个人资料',path: 'views/SysSettings/UserInfo' },
            { index: 'AccountSetting', label: '账户设置',path: 'views/SysSettings/AccountSetting' },
          ],
        },
        {
          index: 'Demo',
          label: '案例演示',
          icon: Setting,
          children: [
            { index: 'permissionsInfoOne', label: '权限演示-1',path: 'views/Demos/permissionsInfoOne' },
            { index: 'permissionsInfoTwo', label: '权限演示-2',path: 'views/Demos/permissionsInfoTwo' },
            { index: 'CustomTableOne', label: '客制表演示-1',path: 'views/Demos/CustomTableOne' },
            { index: 'CustomFromOne', label: '客制表单演示-1',path: 'views/Demos/CustomFromOne' },
          ],
        },
      ],
    });
  } else if (username === 'user' ) {
    return Mock.mock({
      status_code: 200,
      status: 'success',
      message: 'Operation successful.',
      data: [
        { index: 'Home', label: '首页', icon: Document },
        {
          index: 'SysSettings',
          label: '系统设置',
          icon: Setting,
          children: [
            { index: 'UserInfo', label: '个人资料' },
           
          ],
        },
        {
          index: 'Demo',
          label: '案例演示',
          icon: Setting,
          children: [
            { index: 'permissionsInfoOne', label: '权限演示-1',path: 'views/Demos/permissionsInfoOne' },
            { index: 'permissionsInfoTwo', label: '权限演示-2',path: 'views/Demos/permissionsInfoTwo' },
            { index: 'permissionsInfoThree', label: '权限演示-3',path: 'views/Demos/permissionsInfoThree' },
          ],
        },
      ],
    });
  } else {
    return Mock.mock({
      status_code: 401,
      status: 'fail',
      message: 'Invalid username ,No Menu Data.',
      data: [],
    });
  }
};